package com.link.auth.base.functiontime.service;

import com.link.auth.base.functiontime.model.FunctionTime;
import com.link.auth.base.functiontime.mybatis.mapper.FunctionTimeMapper;
import com.link.auth.util.IdWorkerSingleton;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;

/**
 * 功能耗时帮助类-功能耗时帮助类
 *
 * @author 秦学刚
 * @Date 2019/04/10 15:24
 */
@Service
public class FunctionTimeServiceImpl  implements FunctionTimeService {

    @Resource
    private FunctionTimeMapper functionTimeMapper;

    @Override
    public void insert(@NotNull FunctionTime functionTime) throws Exception {

        if (functionTime.getId() == null) {
            functionTime.setId(IdWorkerSingleton.getInstance().nextId());
            functionTime.setCreatedBy(0L);
            functionTime.setLastUpdatedBy(0L);
        }
        functionTimeMapper.insert(functionTime);
    }
}

